<%--
  Created by IntelliJ IDEA.
  User: xindeyingzi
  Date: 2024/8/16
  Time: 21:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>图书节面2</title>
    <%
        String base = request.getContextPath()+"/";
        String url = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+base;
    %>
    <base href="<%=url%>">
    <script type="text/javascript" src="js/jquery-1.8.3.js"></script>
    <script type="text/javascript" >
    $(document).ready(function () {
     $.get("books/qurey",function (books) {
          forbook(books)
     })
        $("[value='提交']").click(function () {
            var index = $("[type='select']").val();
            var str = $("[name='quv']").val();
            $.get("books/qureyby",{"index":index,"str":str},function (books) {
                   forbook(books);
            });
        })


    });
    $(document).on("click","[title='删除']",function () {
        var id = $(this).attr("name");
        $.get("books/delect",{"bid",bid},function (book) {
            JSON.stringify(book);
                forbook(book);
        });



    });
    function forbook(book) {

        $("thead").empty();
        for (var i=0;i<book.length;i++){
            $("<tr>" +
                "<td>"+book[i].bookName+"<td>" +
                "<td>"+book[i].bookAuthor+"<td>" +
                "<td>"+book[i].bookPublish+"<td>" +
                "<td>"+book[i].bookPage+"<td>" +
                "<td>"+book[i].bookPage+"<td>" +
                "<td><a name='"+book[i].bookId+"' title='删除'>删除</a><a name='"+book[i].bookId+"' >修改</a><td>" +
                "<tr>")
        }

    }
    </script>
</head>
<body>
<select type="select">
    <option value="-1">请选择</option>
    <option value="1">书名</option>
    <option value="2">人名</option>
    <option value="3">出版社</option>
</select>
<input type="text" name="quv">
<input type="button" value="提交">
<table>
    <thead>
    <tr>
        <td>书名</td>
        <td>作者名字</td>
        <td>出版社</td>
        <td>页数</td>
        <td>价格</td>
        <td>操作</td>
    </tr>
    </thead>
    <tbody>

    </tbody>
</table>
</body>
</html>
